package edit;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.UIManager;

import view.MainFrame;
import view.grammardevelopment.DisplayScreen;
import view.grammardevelopment.TextAreaWithScrollPane;
import view.grammardevelopment.editsemantics.CreationRightPanel;

public class PhraseStructurePanel extends JPanel {

	public static void main(String[] args){
		try{
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}catch(Exception e){}
		
		Font oldLabelFont = UIManager.getFont("Label.font");
		UIManager.put("Label.font", oldLabelFont.deriveFont(Font.PLAIN,(float)14));
		
		JFrame mainFrame = new JFrame();
		
		mainFrame.setSize(800,600);
		mainFrame.setExtendedState(Frame.MAXIMIZED_BOTH);
		//mainFrame.setUndecorated(true);
		mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		PhraseStructurePanel p = new PhraseStructurePanel();
		mainFrame.add(p.returnView());
		mainFrame.setVisible(true);
		
	}
	
	public PhraseStructurePanel(){
		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		PSRightPanel rightPanel = new PSRightPanel("Phrase Structure Rule");
		
		JScrollPane inputArea = new JScrollPane();
		inputArea.setBorder(BorderFactory.createTitledBorder("Input"));
		
		JScrollPane outputArea = new JScrollPane();
		outputArea.setBorder(BorderFactory.createTitledBorder("Output"));
		
		JSplitPane ioSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, inputArea, outputArea);
		ioSplitPane.setDividerLocation((int)(MainFrame.getInstance().getWidth()*2.0/5)+ioSplitPane.getInsets().bottom);
		ioSplitPane.setBottomComponent(inputArea);
		
		JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, ioSplitPane, rightPanel);
		splitPane.setDividerLocation( (int)(MainFrame.getInstance().getWidth()*4.0/5 + splitPane.getInsets().left));
		splitPane.setDividerSize(0);
		
		this.add(splitPane);
		
	}
	
	public Component returnView(){
		return this;
	}
}
